home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / CDTV / cdtvtools-11 / includes / cdtv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-24  |  8.4 KB  |  349 lines

  1. #ifndef CDTV_H
  2. #define CDTV_H
  3. /*
  4. ** CDTV Device Driver Include File
  5. **
  6. **    Copyright (c) 1991 Commodore Electronics Ltd.
  7. **    All rights reserved. Confidential and Proprietary.
  8. **    CDTV is a trademark of Commodore Electronics Ltd.
  9. **
  10. **    Written by: Carl Sassenrath
  11. **                Sassenrath Research, Ukiah, CA
  12. **
  13. **    Version of: March 8, 1991 - Sassenrath
  14. **                Revised to use new CDTV_ prefix.
  15. **                Old CD_ prefix still works however.
  16. **
  17. **    Version of: March 11, 1991 - Sassenrath
  18. **                Various control values added.
  19. **
  20. **    Version of: March 15, 1991 - Szucs
  21. **                READ_PAD_BYTES added.
  22. **
  23. */
  24.  
  25. #ifndef    EXEC_NODES_H
  26. #include <exec/nodes.h>
  27. #endif
  28.  
  29. /*
  30. ** CDTV Device Name
  31. **
  32. **    Name passed to OpenDevice to identify the CDTV device.
  33. */
  34. #define    CDTV_NAME "cdtv.device"
  35.  
  36. /*
  37. ** CDTV Device Driver Commands
  38. */
  39. #define    CDTV_RESET         1
  40. #define    CDTV_READ         2
  41. #define    CDTV_WRITE         3
  42. #define    CDTV_UPDATE         4
  43. #define    CDTV_CLEAR         5
  44. #define    CDTV_STOP         6
  45. #define    CDTV_START         7
  46. #define    CDTV_FLUSH         8
  47. #define    CDTV_MOTOR         9
  48. #define    CDTV_SEEK        10
  49. #define    CDTV_FORMAT        11
  50. #define    CDTV_REMOVE        12
  51. #define    CDTV_CHANGENUM        13
  52. #define    CDTV_CHANGESTATE    14
  53. #define    CDTV_PROTSTATUS        15
  54.  
  55. #define    CDTV_GETDRIVETYPE    18
  56. #define    CDTV_GETNUMTRACKS    19
  57. #define    CDTV_ADDCHANGEINT    20
  58. #define    CDTV_REMCHANGEINT    21
  59. #define    CDTV_GETGEOMETRY    22
  60. #define    CDTV_EJECT        23
  61.  
  62. #define    CDTV_DIRECT        32
  63. #define    CDTV_STATUS        33
  64. #define    CDTV_QUICKSTATUS    34
  65. #define    CDTV_INFO        35
  66. #define    CDTV_ERRORINFO        36
  67. #define    CDTV_ISROM        37
  68. #define    CDTV_OPTIONS        38
  69. #define    CDTV_FRONTPANEL        39
  70. #define    CDTV_FRAMECALL        40
  71. #define    CDTV_FRAMECOUNT        41
  72. #define    CDTV_READXL        42
  73. #define    CDTV_PLAYTRACK        43
  74. #define    CDTV_PLAYLSN        44
  75. #define    CDTV_PLAYMSF        45
  76. #define    CDTV_PLAYSEGSLSN    46
  77. #define    CDTV_PLAYSEGSMSF    47
  78. #define    CDTV_TOCLSN        48
  79. #define    CDTV_TOCMSF        49
  80. #define    CDTV_SUBQLSN        50
  81. #define    CDTV_SUBQMSF        51
  82. #define    CDTV_PAUSE        52
  83. #define    CDTV_STOPPLAY        53
  84. #define    CDTV_POKESEGLSN        54
  85. #define    CDTV_POKESEGMSF        55
  86. #define    CDTV_MUTE        56
  87. #define    CDTV_FADE        57
  88. #define    CDTV_POKEPLAYLSN    58
  89. #define    CDTV_POKEPLAYMSF    59
  90. #define    CDTV_GENLOCK        60
  91.  
  92. /*
  93. ** CDTV Errors
  94. */
  95. #define    CDERR_OPENFAIL    (-1)    /* OpenDevice() failed        */
  96. #define    CDERR_ABORTED    (-2)    /* Command has been aborted    */
  97. #define    CDERR_NOTVALID    (-3)    /* IO request not valid        */
  98. #define    CDERR_NOCMD    (-4)    /* No such command        */
  99. #define    CDERR_BADARG    (-5)    /* Bad command argument        */
  100. #define    CDERR_NODISK    (-6)    /* No disk is present        */
  101. #define    CDERR_WRITEPROT (-7)    /* Disk is write protected    */
  102. #define    CDERR_BADTOC    (-8)    /* Unable to recover TOC    */
  103. #define    CDERR_DMAFAILED    (-9)    /* Read DMA failed        */
  104. #define    CDERR_NOROM    (-10)    /* No CD-ROM track present    */
  105.  
  106. /*
  107. ** LSN/MSF Structures and macros
  108. */
  109. struct RMSF
  110. {
  111.     UBYTE    Reserved;
  112.     UBYTE    Minute;
  113.     UBYTE    Second;
  114.     UBYTE    Frame;
  115. };
  116.  
  117. union LSNMSF
  118. {
  119.     ULONG    Raw;    
  120.     ULONG    LSN;        /* Logical Sector Number    */    
  121.     struct    RMSF MSF;    /* Minute, Second, Frame    */
  122. };
  123.  
  124. typedef union LSNMSF CDPOS;
  125. #define    TOMSF(m,s,f) (((ULONG)(m)<<16)+((s)<<8)+(f))
  126.  
  127. /*
  128. ** CDTV Transfer Lists
  129. **
  130. **    To create transfer lists, use an Exec List or MinList structure
  131. **    and AddHead/AddTail nodes of the transfer structure below.
  132. **    Don't forget to initialize the List/MinList before using it!
  133. **
  134. */
  135. struct    CDXL
  136. {
  137.     struct    MinNode Node;    /* double linkage    */
  138.     char    *Buffer;    /* data (word aligned)    */
  139.     LONG    Length;        /* must be even # bytes    */
  140.     void    (*DoneFunc)();    /* called when done    */
  141.     LONG    Actual;        /* bytes transferred    */
  142. };
  143.  
  144. /*
  145. ** CDTV Audio Segment
  146. **
  147. **    To create segment lists, use an Exec List or MinList structure
  148. **    and AddHead/AddTail nodes with the segment structure below.
  149. **    Don't forget to initialize the List/MinList before using it!
  150. */
  151. struct    CDAudioSeg
  152. {
  153.     struct    MinNode Node;    /* double linkage    */
  154.     CDPOS    Start;        /* starting position    */
  155.     CDPOS    Stop;        /* stopping position    */
  156.     void    (*StartFunc)();    /* function to call on start */
  157.     void    (*StopFunc)();    /* function to call on stop  */
  158. };
  159.  
  160. /*
  161. ** CDTV Table of Contents
  162. **
  163. **    The CDTV_TOCLSN and CDTV_TOCMSF comands return an array
  164. **    of this structure.
  165. **
  166. **    Notes:
  167. **
  168. **        The first entry (zero) contains special disk info:
  169. **        the Track field indicates the first track number; the
  170. **        LastTrack field contains the last track number, which is
  171. **        only valid for this first entry; and the Position field
  172. **        indicates the last position (lead out area start) on
  173. **        the disk in MSF format.
  174. */
  175. struct CDTOC
  176. {
  177.     UBYTE    rsvd;        /* not used    */
  178.     UBYTE    AddrCtrl;    /* SubQ info    */
  179.     UBYTE    Track;        /* Track number    */
  180.     UBYTE    LastTrack;    /* Only for entry zero. See note above. */
  181.     CDPOS    Position;
  182. };
  183.  
  184. /*
  185. ** AddrCtrl Values
  186. **
  187. **    These values are returned from both TOC and SUBQ commands.
  188. **    Lower 4 bits are boolean flags. Upper 4 bits are numerical.
  189. */
  190. #define    ADRCTLB_PREEMPH    0    /* audio pre-emphasis    */
  191. #define    ADRCTLB_COPY    1    /* digital copy ok    */
  192. #define    ADRCTLB_DATA    2    /* data track        */
  193. #define    ADRCTLB_4CHAN    3    /* 4 channel audio    */
  194.  
  195. #define    ADRCTLF_PREEMPH    1
  196. #define    ADRCTLF_COPY    2
  197. #define    ADRCTLF_DATA    4
  198. #define    ADRCTLF_4CHAN    8
  199.  
  200. #define    ADRCTL_NOMODE    0x00    /* no mode info        */
  201. #define    ADRCTL_POSITION    0x10    /* position encoded    */
  202. #define    ADRCTL_MEDIACAT    0x20    /* media catalog number    */
  203. #define    ADRCTL_ISRC    0x30    /* ISRC encoded        */
  204. #define    ADRCTL_MASK    0xF0
  205.  
  206. /*
  207. ** CDTV Audio SubQ
  208. */
  209. struct CDSubQ
  210. {
  211.     UBYTE    Status;        /* Audio status */
  212.     UBYTE    AddrCtrl;    /* SubQ info    */
  213.     UBYTE    Track;        /* Track number    */
  214.     UBYTE    Index;        /* Index number    */
  215.     CDPOS    DiskPosition;    /* Position from start of disk  */
  216.     CDPOS    TrackPosition;    /* Position from start of track */
  217.     UBYTE    ValidUPC;    /* Flag for product identifer    */
  218.     UBYTE    pad[3];        /* undefined    */
  219. };
  220.  
  221. /*
  222. ** SubQ Status Values
  223. */
  224. #define    SQSTAT_NOTVALID    0x00    /* audio status not valid    */
  225. #define    SQSTAT_PLAYING    0x11    /* play operation in progress    */
  226. #define    SQSTAT_PAUSED    0x12    /* play is paused        */
  227. #define    SQSTAT_DONE    0x13    /* play completed ok        */
  228. #define    SQSTAT_ERROR    0x14    /* play stopped from error    */
  229. #define    SQSTAT_NOSTAT    0x15    /* no status info        */
  230.  
  231. /*
  232. ** UPC/ISRC Bit Flags
  233. */
  234. #define    SQUPCB_ISRC    0    /* Set for ISRC. Clear for UPC    */
  235. #define    SQUPCB_VALID    7    /* Media catalog detected    */
  236.  
  237. #define    SQUPCF_ISRC    0x01
  238. #define    SQUPCF_VALID    0x80
  239.  
  240. /*
  241. **  Quick-Status Bits
  242. **
  243. **    Bits returned in IO_ACTUAL of the CDTV_QUICKSTATUS.
  244. */
  245. #define    QSB_READY    0
  246. #define    QSB_AUDIO    2
  247. #define    QSB_DONE    3
  248. #define    QSB_ERROR    4
  249. #define    QSB_SPIN    5
  250. #define    QSB_DISK    6
  251. #define    QSB_INFERR    7
  252.  
  253. #define    QSF_READY    0x01
  254. #define    QSF_AUDIO    0x04
  255. #define    QSF_DONE    0x08
  256. #define    QSF_ERROR    0x10
  257. #define    QSF_SPIN    0x20
  258. #define    QSF_DISK    0x40
  259. #define    QSF_INFERR    0x80
  260.  
  261. /*
  262. ** CDTV_GENLOCK values (io_Offset)
  263. */
  264. #define CDTV_GENLOCK_REMOTE    0    /* Remote control    */
  265. #define CDTV_GENLOCK_AMIGA    1    /* Amiga video out    */
  266. #define CDTV_GENLOCK_EXTERNAL    2    /* External video out    */
  267. #define CDTV_GENLOCK_MIXED    3    /* Amiga over external video */
  268.  
  269. /*
  270. ** CDTV_INFO Command values (io_Offset)
  271. */
  272. #define CDTV_INFO_DMAC        0    /* private        */
  273. #define CDTV_INFO_TRIPORT    1    /* private        */
  274. #define CDTV_INFO_BLOCK_SIZE    2    /* CD-ROM block size    */
  275. #define CDTV_INFO_FRAME_RATE    3    /* CD-ROM frame rate    */
  276.  
  277. /*
  278. ** CDTV_OPTIONS Command values (io_Offset)
  279. */
  280. #define CDTV_OPTIONS_BLOCK_SIZE 1    /* CD-ROM block size    */
  281. #define CDTV_OPTIONS_ERROR_TYPE    2    /* Error recovery type    */
  282.  
  283.  
  284. /*
  285. ** Other CDTV Constants
  286. */
  287. #define    READ_PAD_BYTES        8    /* # bytes at end of read */
  288.  
  289. /*
  290. ** Old CDTV Definitions
  291. **
  292. **    Obsolete - Do not use these.
  293. */
  294. #define    CD_NAME    "cdtv.device"
  295. #define    CD_RESET         1
  296. #define    CD_READ             2
  297. #define    CD_WRITE         3
  298. #define    CD_UPDATE         4
  299. #define    CD_CLEAR         5
  300. #define    CD_STOP             6
  301. #define    CD_START         7
  302. #define    CD_FLUSH         8
  303. #define    CD_MOTOR         9
  304. #define    CD_SEEK            10
  305. #define    CD_FORMAT        11
  306. #define    CD_REMOVE        12
  307. #define    CD_CHANGENUM        13
  308. #define    CD_CHANGESTATE        14
  309. #define    CD_PROTSTATUS        15
  310.  
  311. #define    CD_GETDRIVETYPE        18
  312. #define    CD_GETNUMTRACKS        19
  313. #define    CD_ADDCHANGEINT        20
  314. #define    CD_REMCHANGEINT        21
  315. #define    CD_GETGEOMETRY        22
  316. #define    CD_EJECT        23
  317.  
  318. #define    CD_DIRECT        32
  319. #define    CD_STATUS        33
  320. #define    CD_QUICKSTATUS        34
  321. #define    CD_INFO            35
  322. #define    CD_ERRORINFO        36
  323. #define    CD_ISROM        37
  324. #define    CD_OPTIONS        38
  325. #define    CD_FRONTPANEL        39
  326. #define    CD_FRAMECALL        40
  327. #define    CD_FRAMECOUNT        41
  328. #define    CD_READXL        42
  329. #define    CD_PLAYTRACK        43
  330. #define    CD_PLAYLSN        44
  331. #define    CD_PLAYMSF        45
  332. #define    CD_PLAYSEGSLSN        46
  333. #define    CD_PLAYSEGSMSF        47
  334. #define    CD_TOCLSN        48
  335. #define    CD_TOCMSF        49
  336. #define    CD_SUBQLSN        50
  337. #define    CD_SUBQMSF        51
  338. #define    CD_PAUSE        52
  339. #define    CD_STOPPLAY        53
  340. #define    CD_POKESEGLSN        54
  341. #define    CD_POKESEGMSF        55
  342. #define    CD_MUTE            56
  343. #define    CD_FADE            57
  344. #define    CD_POKEPLAYLSN        58
  345. #define    CD_POKEPLAYMSF        59
  346. #define    CD_GENLOCK        60
  347.  
  348. #endif    /* CDTV_H */
  349.